$(function(){
	$('.theme-thumbnail').each(function(){
		var e = $(this);
		if(e.attr("title")=="") return;
		e.bt('<img src="'+e.attr("title")+'" width="400" height="300" />', 
		{
			width: 400, 
			height: 300,
			fill: 'white',
			strokeStyle: '#999',
			shrinkToFit: true,
			hoverIntentOpts: {interval: 0,timeout: 0}
		});
	});
});

function install(iThemeID)
{
	$("#theme-"+iThemeID).attr("class","installed");

	$.ajax({
		type: "GET",
		url: "./?app=template&task=ajax_install&theme_id="+iThemeID,
		dataType: "json",
		success: function(json){
			if(json.status=="0")
			{
				alert("安装成功， 现右你可以到已安装的主题中启用!");
			}
			else
			{
				alert("按装失败: "+json.description);
				$("#theme-"+iThemeID).attr("class","noinstall");
			}

		}
	});	
}
